// energypool. txt
//Standard script for healing pool.
//Cell 0 - Who is helps. 0 - just friendly. 1 - everyone.
//Cell 1,2 - Stuff done flag. If both are 0, always on. Otherwise, this flag needs to be
// > 0 for the pool to be active.

beginobjectscript; 

variables;

body;

beginstate INIT_STATE;
	break;

beginstate DEAD_STATE;

break;

beginstate START_STATE; // pool dark, waititng
	if (get_nearest_party_char(2) >= 0) {
		if ((get_memory_cell(1) > 0) || (get_memory_cell(2) > 0)) {
			if (get_flag(get_memory_cell(1),get_memory_cell(2)) == 0) {
				print_str("Energy Pool: It's not working now. It's not charged.");
				end();
				}
			}

		run_sparkles_on_object(ME,4,12,1);
		pc_heard_sound(109);
		run_object_animation(2,1,35);
		if (get_memory_cell(0) == 0)
			restore_energy_nearby(25,25,2,0);
			else restore_energy_nearby(25,25,2,2);
		set_state(3);
		}
break;

beginstate 3; // pool flaring
	if (am_i_doing_action() == FALSE) {
		set_state(START_STATE);
		}
break;
